package com.gxa.www.cl.service.impl;

import com.gxa.www.cl.mapper.InboundStatisticMapper;
import com.gxa.www.cl.service.InboundStatisticService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class InboundStatisticServiceImpl implements InboundStatisticService {

    @Autowired
    private InboundStatisticMapper inboundStatisticMapper;

    @Override
    public List<Map<String, Object>> getInboundStatistics(String category, String name, String date) {
        // 获取原始数据
        Map<String, Map<String, Object>> data = inboundStatisticMapper.getInboundStatistics(category, name, date);

        // 创建一个列表来存储每个统计结果
        List<Map<String, Object>> resultList = new ArrayList<>();

        // 遍历原始数据并将其添加到列表中
        for (Map.Entry<String, Map<String, Object>> entry : data.entrySet()) {
            resultList.add(entry.getValue());
        }

        // 返回结果列表
        return resultList;
    }

}